export const columns = (that) => {
    return [
        {
            type: 'index',
            title: '序号',
            width: 80,
            align: 'center',
        },
        {
            key: 'typeImgUrls',
            title: '图片',
            minWidth: 70,
            align: 'center',
            render: (h, params) => {
                return h('div', {
                    on: {
                        click: () => {
                            that.showBigImage(params)
                        }
                    }
                }, [
                    h('Avatar', {
                        props: {
                            src: 'http://127.0.0.1:8001/' + params.row.typeImgUrls,
                            size: "large",
                            shape: "square",
                        }
                    })
                ])
            }
        },
        {
            key: 'typeCode',
            title: '分类编号',
            minWidth: 120,
            align: 'center',
        },
        {
            key: 'typeName',
            title: '分类名称',
            minWidth: 120,
            align: 'center',
        },
        {
            key: 'typeLevel',
            title: '分类级别',
            minWidth: 120,
            align: 'center',
            render: (h, params) => {
                return h('div', [params.row.typeLevel == 1 ? '一级' : '二级'
                ])
            }
        },
        {
            key: 'typeParentName',
            title: '父级名称',
            minWidth: 120,
            align: 'center'
        },
        {
            key: 'action',
            title: '操作',
            align: 'center',
            fixed: 'right',
            width: '275',
            render: (h, params) => {
                return h('div', [
                    h(
                        'Button',
                        {
                            props: {
                                type: 'primary',
                                size: 'small',
                                // disabled: params.row.name == '管理员'
                            },
                            style: {
                                marginRight: '5px'
                            },
                            on: {
                                click: () => {
                                    that.editType(params.row, params.index)
                                }
                            }
                        },
                        '编辑'
                    ),
                    h(
                        'CustomPopTipButton',
                        {
                            props: {
                                confirmTitle: '确定删除？',
                                btnType: 'error',
                                btnSize: 'small',
                                btnText: '删除',
                                // icon: 'md-trash',
                                // disabled: params.row.name === '管理员'
                            },
                            on: {
                                ok: () => {
                                    that.deleteType(params.row.id)
                                },
                            },
                        },
                        '删除'
                    )
                ])
            }
        }
    ]
}